package trainfengxing.mapper;


import org.apache.ibatis.annotations.*;
import trainfengxing.pojo.news;
import trainfengxing.pojo.order;

import java.util.List;

@Mapper
public interface orderMapper {

    @Insert("INSERT INTO orders(`seatID`,`starting`,`terminal`,`departure`,`arrival`,`seatType`,`price`,`grade`,`userID`,`state`) VALUES(#{seatID},#{starting},#{terminal},#{arrival},#{departure},#{seatType},#{price},#{grade},#{userID},#{state})")
    void order(order order);


    @Select("SELECT * FROM orders WHERE `userID` = #{userID}")
    List<order> selectorder(Integer userID);


    @Delete("DELETE FROM orders WHERE `Ordernumber` = #{Ordernumber}")
    void deletetrainorder(order order);


    @Select("SELECT * FROM news")
    List<news> newsselect();


    @Update("UPDATE orders SET `starting` = #{starting},`terminal` = #{terminal},`departure` = #{departure},`arrival` = #{arrival},`seatType` = #{seatType},`price` = #{price},`grade` = #{grade} WHERE `ordernumber` = #{ordernumber};")
    void changeorder(order order);
}
